package com.example.demo.dao;

import com.example.demo.entity.Book;
import com.example.demo.entity.User;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.ArrayList;

@Repository
public interface BookMapper {
    Book selectBookById(@Param("book_id") String book_id);

    void insertBook(@Param("book_id") String book_id, @Param("book_name") String book_name,
                    @Param("book_author") String book_author, @Param("book_publisher") String book_publisher,
                    @Param("book_type") String book_type, @Param("book_price") BigDecimal book_price,
                    @Param("book_degree") String book_degree, @Param("book_description") String book_description,
                    @Param("book_image") String book_image, @Param("seller_id") String seller_id,
                    @Param("book_status") String book_status, @Param("post_time") Timestamp post_time);

    void updateBook(@Param("book_id") String book_id, @Param("book_name") String book_name,
                    @Param("book_author") String book_author, @Param("book_publisher") String book_publisher,
                    @Param("book_type") String book_type, @Param("book_price") BigDecimal book_price,
                    @Param("book_degree") String book_degree, @Param("book_description") String book_description,
                    @Param("book_image") String book_image, @Param("seller_id") String seller_id,
                    @Param("buyer_id") String buyer_id, @Param("book_status") String book_status,
                    @Param("post_time") Timestamp post_time, @Param("trade_time") Timestamp trade_time,
                    @Param("accomplish_time") Timestamp accomplish_time);

    ArrayList<Book> selectBookByInfo(@Param("book_name") String book_name, @Param("book_type") String book_type,
                                     @Param("order_type") String order_type);

    ArrayList<Book> selectBookByUser(@Param("user_id") String user_id, @Param("select_type") String select_type);

}
